Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumped Axios version to ">=0.25.0" #1190

Closed
wants to merge 1 commit into from

Conversation

aniltallam
Copy link

If the response size for any SOAP API is greater than 0x1fffffe8 characters then getting the following uncaught error and node process is crashing.

Error: Cannot create a string longer than 0x1fffffe8 characters
    at Buffer.utf8Slice (<anonymous>)
    at Buffer.toString (buffer.js:799:17)
    at IncomingMessage.handleStreamEnd (/ws/node_modules/soap/node_modules/axios/lib/adapters/http.js:262:41)
    at IncomingMessage.emit (events.js:327:22)
    at IncomingMessage.EventEmitter.emit (domain.js:467:12)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'ERR_STRING_TOO_LONG'
}

The issue is due to older version of Axios (https://github.com/axios/axios/blob/v0.21.1/lib/adapters/http.js#L253) not properly handling this error.

But this is fixed in v0.25.0 of Axios (https://github.com/axios/axios/blob/v0.25.0/lib/adapters/http.js#L302). So bumped the axios version to >=0.25.0 in the package.json

@aniltallam
Copy link
Author

@vpulim can you look at this PR .
btw some test cases are failing. not sure if we can ignore and comment them.

@jsdevel
Copy link
Collaborator

jsdevel commented Aug 17, 2022

@aniltallam please update with the latest from master

@benasher44
Copy link
Contributor

I think this is covered by #1192

@liudonghua123
Copy link

I have conflicts when using this package with the latest [email protected] installed in my project.

Hope the axios in node-soap could updated!

@becerriljc
Copy link

Hope the axios in node-soap could updated!

I Hope too, the axios updated!

@liudonghua123
Copy link

But this pr seems not work, the code related to axios need to update too.

@lehh
Copy link

lehh commented Nov 20, 2022

I have conflicts when using this package with the latest [email protected] installed in my project.

Hope the axios in node-soap could updated!

I believe it's an axios problem. They fixed it in the axios package itself, and it is supposed to be released on v1.2.0.

@liudonghua123
Copy link

I can confirm axios v1.2.0 could fix it. Because v1.2.0 is not release now, I tested with [email protected], and it worked.

D:\code\node\soap-example>node mail_ws_test.js        

requestToken result: ......

D:\code\node\soap-example>npm i -S axios           

added 3 packages, changed 7 packages, and audited 140 packages in 6s

11 packages are looking for funding
  run `npm fund` for details

5 vulnerabilities (1 moderate, 1 high, 3 critical)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

D:\code\node\soap-example>node mail_ws_test.js 
TypeError: Cannot read properties of undefined (reading 'create')
    at new HttpClient (D:\code\node\soap-example\node_modules\soap\lib\http.js:40:59)
    at Object.open_wsdl (D:\code\node\soap-example\node_modules\soap\lib\wsdl\index.js:1270:48)
    at openWsdl (D:\code\node\soap-example\node_modules\soap\lib\soap.js:70:16)
    at D:\code\node\soap-example\node_modules\soap\lib\soap.js:48:13
    at _requestWSDL (D:\code\node\soap-example\node_modules\soap\lib\soap.js:76:9)
    at createClient (D:\code\node\soap-example\node_modules\soap\lib\soap.js:94:5)
    at D:\code\node\soap-example\node_modules\soap\lib\soap.js:104:9
    at new Promise (<anonymous>)
    at Object.createClientAsync (D:\code\node\soap-example\node_modules\soap\lib\soap.js:103:12)
    at main (D:\code\node\soap-example\mail_ws_test.js:64:31)

D:\code\node\soap-example>npm i -S [email protected]
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/axios
npm WARN   peer axios@">=0.21.1" from [email protected]
npm WARN   node_modules/soap
npm WARN     soap@"^0.45.0" from the root project
npm WARN   1 more (the root project)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer axios@">=0.21.1" from [email protected]
npm WARN node_modules/soap
npm WARN   soap@"^0.45.0" from the root project

changed 1 package, and audited 140 packages in 2s

11 packages are looking for funding
  run `npm fund` for details

5 vulnerabilities (1 moderate, 1 high, 3 critical)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

D:\code\node\soap-example>node mail_ws_test.js        

requestToken result: ......

D:\code\node\soap-example>

@liudonghua123
Copy link

The 1.2.0 version of axios is released, see https://www.npmjs.com/package/axios. I tested, it works without change node-soap code, just update axios dependence to ^1.2.0.

@jsdevel
Copy link
Collaborator

jsdevel commented Dec 9, 2022

plz resolve the conflicts

@andrew-dias
Copy link

andrew-dias commented Dec 15, 2022

I think this is covered by #1192

Was it necessary to change the axios version resolution in #1192 from >= to ^? This causes a regression where axios versions >=1.0 are no longer compatible (at least in npm v7+ I think).

@benasher44
Copy link
Contributor

No it was a mistake. Didn't realize axios was 1.0. Should probably just upgrade this package?

@andrew-dias
Copy link

I wouldn't upgrade the peer dependency to 1.0.0 because that would just break it for anyone still on 0.x, and we want the peer dependency to reflect the lowest compatible version. We could even drop it back to >=0.25.0 as this PR proposed, if that is the minimum compatible version (I'm not sure if you upgraded to 0.27.2 just because it was the latest available version, or if it was actually required for your PR).

@benasher44
Copy link
Contributor

It was just the latest available version at the time

@andrew-dias
Copy link

I am able to work with axios v1.x by using the overrides field in package.json:

  "overrides": {
    "soap": {
      "axios": ">=0.25.0"
    }
  },

@rmkanda
Copy link

rmkanda commented Jan 3, 2023

Can we mark the peer dependency to support old and new versions?

"peerDependencies": {
  "axios": "^0.27.2 || ^1.2.2"
}

@andrew-dias
Copy link

Can we mark the peer dependency to support old and new versions?

"peerDependencies": {
  "axios": "^0.27.2 || ^1.2.2"
}

No need to be any more restrictive than what this PR already proposes:

  "peerDependencies": {
    "axios": ">=0.25.0"
  },

@w666
Copy link
Collaborator

w666 commented Apr 18, 2024

Should not be problem anymore, new version released with updated axios.

@w666 w666 closed this Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants